package com.mkx.infrastructure.repository;

import com.mkx.infrastructure.entity.TenantUserEntity;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * 租户用户仓储接口
 */
@Repository
public interface TenantUserRepository {

    Optional<TenantUserEntity> findByTenantIdAndUserId(String tenantId, String userId);

    List<TenantUserEntity> findByTenantId(String tenantId);

    List<TenantUserEntity> findByUserId(String userId);

    List<TenantUserEntity> findByTenantIdAndRoleId(String tenantId, String roleId);

    List<TenantUserEntity> findByTenantId(String tenantId, Pageable pageable);

    long countByTenantId(String tenantId);

    boolean existsByTenantIdAndUserId(String tenantId, String userId);

    boolean deleteByTenantIdAndUserId(String tenantId, String userId);

    int deleteAllByUserId(String userId);

    int deleteAllByTenantId(String tenantId);
}